package org.flexlancer.databases
{
	public class PersonType
	{
		private static const TABLE:String = "persontype";
		
		public static function Add(typename:String):void{
			try{
				var insertObj:Object = new Object();
				insertObj.typename = typename;
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function Update(typeid:Number,typename:String):void{
			try{
				var updateObj:Object = new Object();
				updateObj.typename = typename;
				DatabaseManager.Manager.Update(TABLE,updateObj,"persontypeid = "+typeid);
			}catch(err:Error){
				throw err;
			}
		}

		public static function Dekete(condition:String=""):void{
			try{
				DatabaseManager.Manager.Delete(TABLE,condition);
			}catch(err:Error){
				throw err;
			}
		}

		public static function List(condition:String = ""):Array{
			try{
				return DatabaseManager.Manager.Select(TABLE,null,condition,"typename");
			}catch(err:Error){
				throw err;
			}
			return new Array;
		}
	}
}